﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace XcoAppSpaces
{
	/// <summary>
	/// Helper methods for parsing because Compact Framework doesn't support TryParse methods.
	/// </summary>
	static class ParseHelper
	{
		public static bool TryParse(string str, out int value)
		{
			value = 0;
			try
			{
				value = int.Parse(str);
				return true;
			}
			catch (Exception)
			{
				return false;
			}
		}

		public static bool TryParse(string str, out bool value)
		{
			value = false;
			try
			{
				value = bool.Parse(str);
				return true;
			}
			catch (Exception)
			{
				return false;
			}
		}
	}
}
